home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / config.c < prev    next >
C/C++ Source or Header  |  1992-05-31  |  21KB  |  808 lines

  1. /* @(#) $Header: config.c,v 1.19 92/05/28 13:50:10 deyke Exp $ */
  2.  
  3. /* A collection of stuff heavily dependent on the configuration info
  4.  * in config.h. The idea is that configuration-dependent tables should
  5.  * be located here to avoid having to pepper lots of .c files with #ifdefs,
  6.  * requiring them to include config.h and be recompiled each time config.h
  7.  * is modified.
  8.  *
  9.  * Copyright 1991 Phil Karn, KA9Q
  10.  */
  11.  
  12. #include <stdio.h>
  13. /* #include <dos.h> */
  14. #include "global.h"
  15. #include "config.h"
  16. #include "mbuf.h"
  17. #include "timer.h"
  18. #include "proc.h"
  19. #include "iface.h"
  20. #include "ip.h"
  21. #include "tcp.h"
  22. #include "udp.h"
  23. #ifdef  ARCNET
  24. #include "arcnet.h"
  25. #endif
  26. #include "lapb.h"
  27. #include "ax25.h"
  28. #include "enet.h"
  29. #include "kiss.h"
  30. /* #include "nr4.h" */
  31. #include "nrs.h"
  32. #include "netrom.h"
  33. #include "pktdrvr.h"
  34. /* #include "ppp.h" */
  35. #include "slip.h"
  36. #include "arp.h"
  37. #include "icmp.h"
  38. #include "hardware.h"   /***/
  39. /* #include "usock.h" */
  40. #include "cmdparse.h"
  41. #include "commands.h"
  42. /* #include "mailbox.h" */
  43. #include "ax25mail.h"
  44. /* #include "nr4mail.h" */
  45. #include "tipmail.h"
  46. #include "daemon.h"
  47. #include "bootp.h"
  48. #include "asy.h"
  49. #include "trace.h"
  50. #ifdef  QTSO
  51. #include "qtso.h"
  52. #endif
  53.  
  54. static int dostart __ARGS((int argc,char *argv[],void *p));
  55. static int dostop __ARGS((int argc,char *argv[],void *p));
  56. static int dostatus __ARGS((int argc,char *argv[],void *p));
  57.  
  58. #ifdef  AX25
  59. static void axip __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  60.     char *dest,struct mbuf *bp,int mcast));
  61. static void axarp __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  62.     char *dest,struct mbuf *bp,int mcast));
  63. static void axnr __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  64.     char *dest,struct mbuf *bp,int mcast));
  65. #endif  /* AX25 */
  66.  
  67. struct mbuf *Hopper;            /* Queue of incoming packets */
  68. unsigned Nsessions = NSESSIONS;
  69. int Shortstatus;
  70.  
  71. /* Free memory threshold, below which things start to happen to conserve
  72.  * memory, like garbage collection, source quenching and refusing connects
  73.  */
  74. int32 Memthresh = MTHRESH;
  75.  
  76. /* Command lookup and branch tables */
  77. struct cmds Cmds[] = {
  78.     /* The "go" command must be first */
  79.     "",             go,             0, 0, NULLCHAR,
  80. #ifndef AMIGA
  81.     "!",            doshell,        0, 0, NULLCHAR,
  82. #endif
  83. /*      "abort",        doabort,        0, 0, NULLCHAR, */
  84. #ifdef  AMIGA
  85.     "amiga",        doamiga,        0, 0, NULLCHAR,
  86. #endif
  87. #if     (defined(MAC) && defined(APPLETALK))
  88.     "applestat",    doatstat,       0,      0, NULLCHAR,
  89. #endif
  90. #if     (defined(AX25) || defined(ETHER) || defined(APPLETALK))
  91.     "arp",          doarp,          0, 0, NULLCHAR,
  92. #endif
  93. #ifdef  ASY
  94.     "asystat",      doasystat,      0, 0, NULLCHAR,
  95. #endif
  96.     "attach",       doattach,       0, 2,
  97.         "attach <hardware> <hw specific options>",
  98. #ifdef  AX25
  99.     "ax25",         doax25,         0, 0, NULLCHAR,
  100.     "axip",         doaxip,         0, 0, NULLCHAR,
  101.     "axudp",        doaxudp,        0, 0, NULLCHAR,
  102. #endif
  103. #ifdef  BOOTP
  104.     "bootp",        dobootp,        0, 0, NULLCHAR,
  105.     "bootpd",       bootpdcmd,      0, 0, NULLCHAR,
  106. #endif
  107.     "bye",          dobye,          0, 0, NULLCHAR,
  108. /* This one is out of alpabetical order to allow abbreviation to "c" */
  109. #ifdef  AX25
  110.     "connect",      doconnect,      1024, 2,
  111.     "connect callsign [digipeaters]",
  112. #endif
  113. #if     !defined(UNIX) && !defined(AMIGA)
  114.     "cd",           docd,           0, 0, NULLCHAR,
  115. #endif
  116.     "close",        doclose,        0, 0, NULLCHAR,
  117. /* This one is out of alpabetical order to allow abbreviation to "d" */
  118.     "disconnect",   doclose,        0, 0, NULLCHAR,
  119.     "delete",       dodelete,       0, 2, "delete <file>",
  120. /*      "detach",       dodetach,       0, 2, "detach <interface>", */
  121. #ifdef  DIALER
  122.     "dialer",       dodialer,       0, 2,
  123.     "dialer <iface> <timeout> [<raise script> <lower script>]",
  124. #endif
  125. #ifndef AMIGA
  126. /*      "dir",          dodir,          512, 0, NULLCHAR, /* note sequence */
  127. #endif
  128.     "domain",       dodomain,       0, 0, NULLCHAR,
  129. #ifdef  DRSI
  130.     "drsistat",     dodrstat,       0, 0, NULLCHAR,
  131. #endif
  132. #ifdef  EAGLE
  133.     "eaglestat",    doegstat,       0, 0, NULLCHAR,
  134. #endif
  135.     "echo",         doecho,         0, 0, NULLCHAR,
  136.     "eol",          doeol,          0, 0, NULLCHAR,
  137. #if     !defined(MSDOS)
  138.     "escape",       doescape,       0, 0, NULLCHAR,
  139. #endif
  140.     "exit",         doexit,         0, 0, NULLCHAR,
  141. /*      "files",        dofiles,        0, 0, NULLCHAR, */
  142.     "finger",       dofinger,       1024, 2, "finger name@host",
  143.     "fkey",         dofkey,         0, 3, "fkey <key#> <text>",
  144.     "ftp",          doftp,          2048, 2, "ftp <address>",
  145. #ifdef HAPN
  146.     "hapnstat",     dohapnstat,     0, 0, NULLCHAR,
  147. #endif
  148. /*      "help",         dohelp,         0, 0, NULLCHAR, */
  149. #ifdef  HOPCHECK
  150.     "hop",          dohop,          0, 0, NULLCHAR,
  151. #endif
  152.     "hostname",     dohostname,     0, 0, NULLCHAR,
  153. #ifdef  HS
  154.     "hs",           dohs,           0, 0, NULLCHAR,
  155. #endif
  156.     "icmp",         doicmp,         0, 0, NULLCHAR,
  157.     "ifconfig",     doifconfig,     0, 0, NULLCHAR,
  158.     "ip",           doip,           0, 0, NULLCHAR,
  159. #ifdef  MSDOS
  160.     "isat",         doisat,         0, 0, NULLCHAR,
  161. #endif
  162.     "kick",         dokick,         0, 0, NULLCHAR,
  163.     "log",          dolog,          0, 0, NULLCHAR,
  164. #ifdef  MAILBOX
  165. /*      "mbox",         dombox,         0, 0, NULLCHAR, */
  166. #endif
  167. #if     1
  168.     "memory",       domem,          0, 0, NULLCHAR,
  169. #endif
  170.     "mkdir",        domkd,          0, 2, "mkdir <directory>",
  171. #ifdef  AX25
  172.     "mode",         domode,         0, 2, "mode <interface>",
  173. #endif
  174. /*      "more",         domore,         512, 2, "more <filename>", */
  175. #ifdef  NETROM
  176.     "netrom",       donetrom,       0, 0, NULLCHAR,
  177. #endif  /* NETROM */
  178. #ifdef  NNTP
  179.     "nntp",         donntp,         0, 0, NULLCHAR,
  180. #endif  /* NNTP */
  181. #ifdef  NRS
  182.     "nrstat",       donrstat,       0, 0, NULLCHAR,
  183. #endif  /* NRS */
  184.     "param",        doparam,        0, 2, "param <interface>",
  185.     "ping",         doping,         512, 0,
  186.     NULLCHAR,
  187. #ifdef  PI
  188.     "pistatus",     dopistat,       0, 0, NULLCHAR,
  189. #endif
  190. #ifdef POP
  191.     "pop",          dopop,          0, 0, NULLCHAR,
  192. #endif
  193. #ifdef PPP
  194.     "ppp",          doppp_commands, 0, 0, NULLCHAR,
  195. #endif
  196.     "ps",           ps,             0, 0, NULLCHAR,
  197. #if     !defined(UNIX) && !defined(AMIGA)
  198.     "pwd",          docd,           0, 0, NULLCHAR,
  199. #endif
  200.     "record",       dorecord,       0, 0, NULLCHAR,
  201.     "remote",       doremote,       0, 3, "remote [-p port] [-k key] [-a kickaddr] <address> exit|reset|kick",
  202.     "rename",       dorename,       0, 3, "rename <oldfile> <newfile>",
  203.     "reset",        doreset,        0, 0, NULLCHAR,
  204. #ifdef  RIP
  205.     "rip",          dorip,          0, 0, NULLCHAR,
  206. #endif
  207.     "rmdir",        dormd,          0, 2, "rmdir <directory>",
  208.     "route",        doroute,        0, 0, NULLCHAR,
  209.     "session",      dosession,      0, 0, NULLCHAR,
  210.     "status",       dostatus,       0, 0, NULLCHAR,
  211. #ifdef  SCC
  212.     "sccstat",      dosccstat,      0, 0, NULLCHAR,
  213. #endif
  214. #if     !defined(AMIGA)
  215.     "shell",        doshell,        0, 0, NULLCHAR,
  216. #endif
  217.     "smtp",         dosmtp,         0, 0, NULLCHAR,
  218. /*      "socket",       dosock,         0, 0, NULLCHAR, */
  219.     "source",       dosource,       0, 2, "source <filename>",
  220. #ifdef  SERVERS
  221.     "start",        dostart,        0, 2, "start <servername>",
  222.     "stop",         dostop,         0, 2, "stop <servername>",
  223. #endif
  224.     "tcp",          dotcp,          0, 0, NULLCHAR,
  225.     "telnet",       dotelnet,       1024, 2, "telnet <address>",
  226. /*      "test",         dotest,         1024, 0, NULLCHAR, */
  227. /*      "tip",          dotip,          256, 2, "tip <iface", */
  228. #ifdef  TRACE
  229.     "trace",        dotrace,        512, 0, NULLCHAR,
  230. #endif
  231.     "udp",          doudp,          0, 0, NULLCHAR,
  232.     "upload",       doupload,       0, 0, NULLCHAR,
  233. #ifdef  MSDOS
  234.     "watch",        doswatch,       0, 0, NULLCHAR,
  235. #endif
  236. /*      "?",            dohelp,         0, 0, NULLCHAR, */
  237.     NULLCHAR,       NULLFP,         0, 0,
  238.         "Unknown command; type \"?\" for list",
  239. };
  240.  
  241. /* List of supported hardware devices */
  242. struct cmds Attab[] = {
  243. #ifdef  ASY
  244.     /* Ordinary PC asynchronous adaptor */
  245.     "asy", asy_attach, 0, 8,
  246. #ifndef AMIGA
  247.     "attach asy <address> <vector> slip|ax25|nrs <label> <buffers> <mtu> <speed> [ip_addr]",
  248. #else
  249.     "attach asy <driver> <unit> slip|ax25|nrs <label> <buffers> <mtu> <speed> [ip_addr]",
  250. #endif  /* AMIGA */
  251. #endif  /* ASY */
  252. #ifdef  PC100
  253.     /* PACCOMM PC-100 8530 HDLC adaptor */
  254.     "pc100", pc_attach, 0, 8,
  255.     "attach pc100 <address> <vector> ax25 <label> <buffers>\
  256.  <mtu> <speed> [ip_addra] [ip_addrb]",
  257. #endif
  258. #ifdef  DRSI
  259.     /* DRSI PCPA card in low speed mode */
  260.     "drsi", dr_attach, 0, 8,
  261.     "attach drsi <address> <vector> ax25 <label> <bufsize> <mtu>\
  262. <chan a speed> <chan b speed> [ip addr a] [ip addr b]",
  263. #endif
  264. #ifdef  EAGLE
  265.     /* EAGLE RS-232C 8530 HDLC adaptor */
  266.     "eagle", eg_attach, 0, 8,
  267.     "attach eagle <address> <vector> ax25 <label> <buffers>\
  268.  <mtu> <speed> [ip_addra] [ip_addrb]",
  269. #endif
  270. #ifdef  PI
  271.     /* PI 8530 HDLC adaptor */
  272.     "pi", pi_attach, 0, 8,
  273.     "attach pi <address> <vector> <dmachannel> ax25 <label> <buffers>\
  274.  <mtu> <speed> [ip_addra] [ip_addrb]",
  275. #endif
  276. #ifdef  HAPN
  277.     /* Hamilton Area Packet Radio (HAPN) 8273 HDLC adaptor */
  278.     "hapn", hapn_attach, 0, 8,
  279.     "attach hapn <address> <vector> ax25 <label> <rx bufsize>\
  280.  <mtu> csma|full [ip_addr]",
  281. #endif
  282. #ifdef  APPLETALK
  283.     /* Macintosh AppleTalk */
  284.     "0", at_attach, 0, 7,
  285.     "attach 0 <protocol type> <device> arpa <label> <rx bufsize> <mtu> [ip_addr]",
  286. #endif
  287. #ifdef NETROM
  288.     /* fake netrom interface */
  289.     "netrom", nr_attach, 0, 1,
  290.     "attach netrom [ip_addr]",
  291. #endif
  292. #ifdef  PACKET
  293.     /* FTP Software's packet driver spec */
  294.     "packet", pk_attach, 0, 4,
  295.     "attach packet <int#> <label> <buffers> <mtu> [ip_addr]",
  296. #endif
  297. #ifdef  HS
  298.     /* Special high speed driver for DRSI PCPA or Eagle cards */
  299.     "hs", hs_attach, 0, 7,
  300.     "attach hs <address> <vector> ax25 <label> <buffers> <mtu>\
  301.  <txdelay> <persistence> [ip_addra] [ip_addrb]",
  302. #endif
  303. #ifdef SCC
  304.     "scc", scc_attach, 0, 7,
  305.     "attach scc <devices> init <addr> <spacing> <Aoff> <Boff> <Dataoff>\n"
  306.     "   <intack> <vec> [p]<clock> [hdwe] [param]\n"
  307.     "attach scc <chan> slip|kiss|nrs|ax25 <label> <mtu> <speed> <bufsize> [call] ",
  308. #endif
  309. #ifdef  AX25
  310.     "axip", axip_attach, 0, 1,
  311.     "attach axip",
  312.     "axudp", axudp_attach, 0, 1,
  313.     "attach axudp",
  314. #endif
  315.     "ipip", ipip_attach, 0, 5,
  316.     "attach ipip <label> ip|udp <dest> <port>",
  317.     NULLCHAR,
  318. };
  319.  
  320. #ifdef  SERVERS
  321. /* "start" and "stop" subcommands */
  322. static struct cmds Startcmds[] = {
  323. #if     defined(AX25) && defined(MAILBOX)
  324.     "ax25",         ax25start,      256, 0, NULLCHAR,
  325. #endif
  326.     "discard",      dis1,           256, 0, NULLCHAR,
  327.     "echo",         echo1,          256, 0, NULLCHAR,
  328. /*      "finger",       finstart,       256, 0, NULLCHAR, */
  329.     "ftp",          ftpstart,       256, 0, NULLCHAR,
  330.     "tcpgate",      tcpgate1,       256, 2, "start tcpgate <tcp port> [<host:service>]",
  331. #if     defined(NETROM) && defined(MAILBOX)
  332.     "netrom",       nr4start,       256, 0, NULLCHAR,
  333. #endif
  334. #ifdef POP
  335.     "pop",          pop1,           256, 0, NULLCHAR,
  336. #endif
  337. #ifdef  RIP
  338.     "rip",          doripinit,      0,   0, NULLCHAR,
  339. #endif
  340. /*      "smtp",         smtp1,          256, 0, NULLCHAR, */
  341. #if     defined(MAILBOX)
  342.     "telnet",       telnet1,        256, 0, NULLCHAR,
  343. /*      "tip",          tipstart,       256, 2, "start tip <interface>", */
  344. #endif
  345. /*      "ttylink",      ttylstart,      256, 0, NULLCHAR, */
  346.     "remote",       rem1,           768, 0, NULLCHAR,
  347.     NULLCHAR,
  348. };
  349.  
  350. static struct cmds Stopcmds[] = {
  351. #if     defined(AX25) && defined(MAILBOX)
  352.     "ax25",         ax250,          0, 0, NULLCHAR,
  353. #endif
  354.     "discard",      dis0,           0, 0, NULLCHAR,
  355.     "echo",         echo0,          0, 0, NULLCHAR,
  356. /*      "finger",       fin0,           0, 0, NULLCHAR, */
  357.     "ftp",          ftp0,           0, 0, NULLCHAR,
  358. #if     defined(NETROM) && defined(MAILBOX)
  359.     "netrom",       nr40,           0, 0, NULLCHAR,
  360. #endif
  361. #ifdef  POP
  362.     "pop",          pop0,           0, 0, NULLCHAR,
  363. #endif
  364. #ifdef  RIP
  365.     "rip",          doripstop,      0, 0, NULLCHAR,
  366. #endif
  367. /*      "smtp",         smtp0,          0, 0, NULLCHAR, */
  368. #ifdef  MAILBOX
  369.     "telnet",       telnet0,        0, 0, NULLCHAR,
  370. /*      "tip",          tip0,           0, 2, "stop tip <interface>", */
  371. #endif
  372. /*      "ttylink",      ttyl0,          0, 0, NULLCHAR, */
  373.     "remote",       rem0,           0, 0, NULLCHAR,
  374.     NULLCHAR,
  375.  
  376. };
  377. #endif  /* SERVERS */
  378.  
  379. /* TCP port numbers to be considered "interactive" by the IP routing
  380.  * code and given priority in queueing
  381.  */
  382. int Tcp_interact[] = {
  383.     IPPORT_FTP,     /* FTP control (not data!) */
  384.     IPPORT_TELNET,  /* Telnet */
  385.     IPPORT_LOGIN,   /* BSD rlogin */
  386.     IPPORT_MTP,     /* Secondary telnet */
  387.     -1
  388. };
  389.  
  390. /* Transport protocols atop IP */
  391. struct iplink Iplink[] = {
  392.     TCP_PTCL,       tcp_input,
  393.     UDP_PTCL,       udp_input,
  394.     ICMP_PTCL,      icmp_input,
  395.     IP_PTCL,        ipip_recv,
  396.     0,              0
  397. };
  398.  
  399. /* Transport protocols atop ICMP */
  400. struct icmplink Icmplink[] = {
  401.     TCP_PTCL,       tcp_icmp,
  402.     0,              0
  403. };
  404.  
  405. #ifdef  AX25
  406. /* Linkage to network protocols atop ax25 */
  407. struct axlink Axlink[] = {
  408.     PID_IP,         axip,
  409.     PID_ARP,        axarp,
  410. #ifdef  NETROM
  411.     PID_NETROM,     axnr,
  412. #endif
  413.     PID_NO_L3,      axnl3,
  414.     0,              NULL,
  415. };
  416. #endif  /* AX25 */
  417.  
  418. /* ARP protocol linkages, indexed by arp's hardware type */
  419. struct arp_type Arp_type[NHWTYPES] = {
  420. #ifdef  NETROM
  421.     AXALEN, 0, 0, 0, NULLCHAR, pax25, setcall,      /* ARP_NETROM */
  422. #else
  423.     0, 0, 0, 0, NULLCHAR,NULL,NULL,
  424. #endif
  425.  
  426. #ifdef  ETHER
  427.     EADDR_LEN,IP_TYPE,ARP_TYPE,1,Ether_bdcst,pether,gether, /* ARP_ETHER */
  428. #else
  429.     0, 0, 0, 0, NULLCHAR,NULL,NULL,
  430. #endif
  431.  
  432.     0, 0, 0, 0, NULLCHAR,NULL,NULL,                 /* ARP_EETHER */
  433.  
  434. #ifdef  AX25
  435.     AXALEN, PID_IP, PID_ARP, 10, Ax25multi[0], pax25, setcall,
  436. #else
  437.     0, 0, 0, 0, NULLCHAR,NULL,NULL,                 /* ARP_AX25 */
  438. #endif
  439.  
  440.     0, 0, 0, 0, NULLCHAR,NULL,NULL,                 /* ARP_PRONET */
  441.  
  442.     0, 0, 0, 0, NULLCHAR,NULL,NULL,                 /* ARP_CHAOS */
  443.  
  444.     0, 0, 0, 0, NULLCHAR,NULL,NULL,                 /* ARP_IEEE802 */
  445.  
  446. #ifdef  ARCNET
  447.     AADDR_LEN, ARC_IP, ARC_ARP, 1, ARC_bdcst, parc, garc, /* ARP_ARCNET */
  448. #else
  449.     0, 0, 0, 0, NULLCHAR,NULL,NULL,
  450. #endif
  451.  
  452.     0, 0, 0, 0, NULLCHAR,NULL,NULL,                 /* ARP_APPLETALK */
  453. };
  454. /* Get rid of trace references in Iftypes[] if TRACE is turned off */
  455. #ifndef TRACE
  456. #define ip_dump         NULLVFP
  457. #define ax25_dump       NULLVFP
  458. #define ki_dump         NULLVFP
  459. #define sl_dump         NULLVFP
  460. #define ether_dump      NULLVFP
  461. #define ppp_dump        NULLVFP
  462. #define arc_dump        NULLVFP
  463. #endif  /* TRACE */
  464.  
  465. /* Table of interface types. Contains most device- and encapsulation-
  466.  * dependent info
  467.  */
  468. struct iftype Iftypes[] = {
  469.     /* This entry must be first, since Loopback refers to it */
  470.     "None",         NULL,           NULL,           NULL,
  471.     NULL,           CL_NONE,        0,
  472.  
  473. #ifdef  AX25
  474.     "AX25",         ax_send,        ax_output,      pax25,
  475.     setcall,        CL_AX25,        AXALEN,
  476. #endif
  477.  
  478. #ifdef  SLIP
  479.     "SLIP",         slip_send,      NULL,           NULL,
  480.     NULL,           CL_NONE,        0,
  481. #endif
  482.  
  483. #ifdef  ETHER
  484.     /* Note: NULL is specified for the scan function even though
  485.      * gether() exists because the packet drivers don't support
  486.      * address setting.
  487.      */
  488.     "Ethernet",     enet_send,      enet_output,    pether,
  489.     NULL,           CL_ETHERNET,    EADDR_LEN,
  490. #endif
  491.  
  492. #ifdef  NETROM
  493.     "NETROM",       nr_send,        NULL,           pax25,
  494.     setcall,        CL_NETROM,      AXALEN,
  495. #endif
  496.  
  497. #ifdef  SLFP
  498.     "SLFP",         pk_send,        NULL,           NULL,
  499.     NULL,           CL_NONE,        0,
  500. #endif
  501.  
  502. #ifdef  PPP
  503.     "PPP",          ppp_send,       ppp_output,     NULL,
  504.     NULL,           CL_PPP, 0,
  505. #endif
  506.  
  507.     NULLCHAR
  508. };
  509.  
  510. /* daemons to be run at startup time */
  511. struct daemon Daemons[] = {
  512.     "killer",       1024,   killer,
  513. /*      "gcollect",     256,    gcollect,       */
  514.     "timer",        16000,  timerproc,
  515.     "network",      16000,  network,
  516. /*      "keyboard",     250,    keyboard,       */
  517.     NULLCHAR,       0,      NULLVFP
  518. };
  519.  
  520. #if     0
  521. void (*Listusers) __ARGS((FILE *network)) = listusers;
  522. #else
  523. void (*Listusers) __ARGS((FILE *network)) = NULL;
  524. #endif  /* MAILBOX */
  525.  
  526. #ifndef BOOTP
  527. int WantBootp = 0;
  528.  
  529. int
  530. bootp_validPacket(ip,bpp)
  531. struct ip *ip;
  532. struct mbuf **bpp;
  533. {
  534.     return 0;
  535. }
  536. #endif  /* BOOTP */
  537.  
  538. /* Packet tracing stuff */
  539. #ifdef  TRACE
  540. #include "trace.h"
  541.  
  542. /* Protocol tracing function pointers. Matches list of class definitions
  543.  * in pktdrvr.h.
  544.  */
  545. struct trace Tracef[] = {
  546.     NULLFP,         ip_dump,        /* CL_NONE */
  547.  
  548. #ifdef  ETHER                           /* CL_ETHERNET */
  549.     ether_forus,    ether_dump,
  550. #else
  551.     NULLFP,         NULLVFP,
  552. #endif  /* ETHER */
  553.  
  554.     NULLFP,         NULLVFP,        /* CL_PRONET_10 */
  555.     NULLFP,         NULLVFP,        /* CL_IEEE8025 */
  556.     NULLFP,         NULLVFP,        /* CL_OMNINET */
  557.  
  558. #ifdef  APPLETALK
  559.     at_forus,       at_dump,        /* CL_APPLETALK */
  560. #else
  561.     NULLFP,         NULLVFP,
  562. #endif  /* APPLETALK */
  563.  
  564. #ifdef VJCOMPRESS
  565.     NULLFP,         sl_dump,        /* CL_SERIAL_LINE */
  566. #else
  567.     NULLFP,         ip_dump,        /* CL_SERIAL_LINE */
  568. #endif
  569.     NULLFP,         NULLVFP,        /* CL_STARLAN */
  570.  
  571. #ifdef  ARCNET
  572.     arc_forus,      arc_dump,       /* CL_ARCNET */
  573. #else
  574.     NULLFP,         NULLVFP,
  575. #endif  /* ARCNET */
  576.  
  577. #ifdef  AX25
  578.     ax_forus,       ax25_dump,      /* CL_AX25 */
  579. #else
  580.     NULLFP,         NULLVFP,
  581. #endif  /* AX25 */
  582.  
  583. #ifdef  KISS                            /* CL_KISS */
  584.     ki_forus,       ki_dump,
  585. #else
  586.     NULLFP,         NULLVFP,
  587. #endif  /* KISS */
  588.  
  589.     NULLFP,         NULLVFP,        /* CL_IEEE8023 */
  590.     NULLFP,         NULLVFP,        /* CL_FDDI */
  591.     NULLFP,         NULLVFP,        /* CL_INTERNET_X25 */
  592.     NULLFP,         NULLVFP,        /* CL_LANSTAR */
  593.     NULLFP,         ip_dump,        /* CL_SLFP */
  594.  
  595. #ifdef  NETROM                          /* CL_NETROM */
  596.     NULLFP,         ip_dump,
  597. #else
  598.     NULLFP,         NULLVFP,
  599. #endif
  600.  
  601. #ifdef PPP
  602.     NULLFP,         ppp_dump,       /* CL_PPP */
  603. #else
  604.     NULLFP,         NULLVFP,
  605. #endif /* PPP */
  606. };
  607.  
  608. #else   /* TRACE */
  609.  
  610. /* Stub for packet dump function */
  611. void
  612. dump(iface,direction,type,bp)
  613. struct iface *iface;
  614. int direction;
  615. unsigned type;
  616. struct mbuf *bp;
  617. {
  618. }
  619. void
  620. raw_dump(iface,direction,bp)
  621. struct iface *iface;
  622. int direction;
  623. struct mbuf *bp;
  624. {
  625. }
  626.  
  627. #endif  /* TRACE */
  628.  
  629. #ifndef TRACEBACK
  630. void
  631. stktrace()
  632. {
  633. }
  634. #endif
  635.  
  636. #ifndef LZW
  637. void
  638. lzwfree(up)
  639. struct usock *up;
  640. {
  641. }
  642. #endif
  643.  
  644. #ifdef  AX25
  645. /* Hooks for passing incoming AX.25 data frames to network protocols */
  646. static void
  647. axip(iface,axp,src,dest,bp,mcast)
  648. struct iface *iface;
  649. struct ax25_cb *axp;
  650. char *src;
  651. char *dest;
  652. struct mbuf *bp;
  653. int mcast;
  654. {
  655.     int32 ipaddr;
  656.     if (bp && bp->cnt >= 20 && (ipaddr = get32(bp->data + 12)))
  657.         arp_add(ipaddr, ARP_AX25, src, 0);
  658.     (void)ip_route(iface,bp,mcast);
  659. }
  660.  
  661. static void
  662. axarp(iface,axp,src,dest,bp,mcast)
  663. struct iface *iface;
  664. struct ax25_cb *axp;
  665. char *src;
  666. char *dest;
  667. struct mbuf *bp;
  668. int mcast;
  669. {
  670.     (void)arp_input(iface,bp);
  671. }
  672.  
  673. #ifdef  NETROM
  674. static void
  675. axnr(iface,axp,src,dest,bp,mcast)
  676. struct iface *iface;
  677. struct ax25_cb *axp;
  678. char *src;
  679. char *dest;
  680. struct mbuf *bp;
  681. int mcast;
  682. {
  683.     nr3_input(bp, src);
  684. }
  685.  
  686. #endif  /* NETROM */
  687. #endif  /* AX25 */
  688.  
  689. #ifndef RIP
  690. /* Stub for routing timeout when RIP is not configured -- just remove entry */
  691. void
  692. rt_timeout(s)
  693. void *s;
  694. {
  695.     struct route *stale = (struct route *)s;
  696.  
  697.     rt_drop(stale->target,stale->bits);
  698. }
  699. #endif
  700.  
  701. /* Stubs for demand dialer */
  702. #ifndef DIALER
  703. void
  704. dialer_kick(asyp)
  705. struct asy *asyp;
  706. {
  707. }
  708. #endif
  709.  
  710. /* Stubs for Van Jacobsen header compression */
  711. #if !defined(VJCOMPRESS) && defined(ASY)
  712. struct slcompress *
  713. slhc_init(rslots,tslots)
  714. int rslots;
  715. int tslots;
  716. {
  717.     return NULLSLCOMPR;
  718. }
  719. int
  720. slhc_compress(comp, bpp, compress_cid)
  721. struct slcompress *comp;
  722. struct mbuf **bpp;
  723. int compress_cid;
  724. {
  725.     return SL_TYPE_IP;
  726. }
  727. int
  728. slhc_uncompress(comp, bpp)
  729. struct slcompress *comp;
  730. struct mbuf **bpp;
  731. {
  732.     return -1;      /* Can't decompress */
  733. }
  734. void
  735. shlc_i_status(comp)
  736. struct slcompress *comp;
  737. {
  738. }
  739. void
  740. shlc_o_status(comp)
  741. struct slcompress *comp;
  742. {
  743. }
  744. int
  745. slhc_remember(comp, bpp)
  746. struct slcompress *comp;
  747. struct mbuf **bpp;
  748. {
  749.     return -1;
  750. }
  751. #endif /* !defined(VJCOMPRESS) && defined(ASY) */
  752.  
  753. #ifdef  SERVERS
  754. static int
  755. dostart(argc,argv,p)
  756. int argc;
  757. char *argv[];
  758. void *p;
  759. {
  760.     return subcmd(Startcmds,argc,argv,p);
  761. }
  762. static int
  763. dostop(argc,argv,p)
  764. int argc;
  765. char *argv[];
  766. void *p;
  767. {
  768.     return subcmd(Stopcmds,argc,argv,p);
  769. }
  770. #endif  /* SERVERS */
  771.  
  772. static int
  773. dostatus(argc,argv,p)
  774. int argc;
  775. char *argv[];
  776. void *p;
  777. {
  778.   char *my_argv[3];
  779.  
  780.   Shortstatus = 1;
  781.   my_argv[1] = "status";
  782.   my_argv[2] = NULLCHAR;
  783.  
  784. #ifdef  AX25
  785.   puts("------------------------------------ AX.25 ------------------------------------");
  786.   my_argv[0] = "ax25";
  787.   doax25(2, my_argv, p);
  788. #endif
  789.  
  790. #ifdef  NETROM
  791.   puts("------------------------------------ NETROM -----------------------------------");
  792.   my_argv[0] = "netrom";
  793.   donetrom(2, my_argv, p);
  794. #endif
  795.  
  796.   puts("------------------------------------- TCP -------------------------------------");
  797.   my_argv[0] = "tcp";
  798.   dotcp(2, my_argv, p);
  799.  
  800.   puts("------------------------------------- UDP -------------------------------------");
  801.   my_argv[0] = "udp";
  802.   doudp(2, my_argv, p);
  803.  
  804.   Shortstatus = 0;
  805.   return 0;
  806. }
  807.  
  808.